rofiles-fuse: Handle operations on the root
authorAlexander Larsson <alexl@redhat.com>
Wed, 24 Feb 2016 11:14:38 +0000 (12:14 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 24 Feb 2016 19:43:23 +0000 (20:43 +0100)
ENSURE_RELPATH breaks when path is "/". In that case we need
to return "." instead of "".

https://bugzilla.gnome.org/show_bug.cgi?id=762596

src/rofiles-fuse/main.c

index 4337f00fee17e2b76742f24b8367c96cb3b5b863..3c910f1f1a4b5102b2f23ee50e32f5dfd13d5314 100644 (file)
@@ -46,7 +46,10 @@ static GHashTable *created_devino_hash = NULL;
 static inline const char *
 ENSURE_RELPATH (const char *path)
 {
-  return path + strspn (path, "/");
+  path = path + strspn (path, "/");
+  if (*path == 0)
+    return ".";
+  return path;
 }
 
 typedef struct {